/*
 * Randomizer.cpp
 *
 *  Created on: 11-01-2011
 *      Author: Przemek
 */

#include "utils/Randomizer.hpp"
#include "pch.hpp"

bool Randomizer::nextBool()
{
	static const int RANGE = 2000;
	return (rand() % RANGE < RANGE / 2);
}

int Randomizer::nextInt(int maxExclusively)
{
	if(maxExclusively == 0)
	{
		return 0;
	}
	return rand() % maxExclusively;
}

int Randomizer::nextInt(int minInclusively, int maxInclusively)
{
	return minInclusively + nextInt(maxInclusively - minInclusively + 1);
}

float Randomizer::nextUniformFloat()
{
	return rand() / float(RAND_MAX);

}

float Randomizer::nextFloat(float min, float max)
{
	return (max - min) * nextUniformFloat() + max;
}

int Randomizer::nextAngleInDegrees()
{
	return nextInt(360);
}
